public class TwoSum {
    public static void main(String[] args) {
        Solution s = new Solution();
        int[] nums = {2, 7, 11, 15};
        int target = 9;
        int[] result = s.twoSum(nums, target);
        for(int element:result) {
            System.out.print(element + " ");
        }
        System.out.println();
    }
}

class Solution {
    public int[] twoSum(int[] nums, int target) {
        for(int i = 0; i < nums.length-1; i++)
        {
            for(int j = i + 1; j < nums.length; j++)
            {
                if(nums[i] + nums[j] == target)
                {
                    int[] ret={0,0};
                    ret[0] = i;
                    ret[1] = j;
                    return ret;
                }
            }
        }
        return new int[0];
    }
}
